//
//  AboutUsView.swift
//  JiaoZiTaxi
//
//  Created by Hu Gang on 2022/12/6.
//

import SwiftUI

struct AboutUsView: View {
    @ObservedObject var vm = ViewModel.shared
    @Environment(\.dismiss) var dismiss
    var body: some View {
        GeometryReader { geometry in
            
            NavigationView {
                VStack {
                    Text("轿子出行")
                        .font(.system(size: 24))
                        .padding(.top,20)
                    HStack {
                        Text("版本：")
                        Text("\(vm.appVersion)")
                    }.padding(.vertical,5)

                    HStack {
                        Image("background")
                            .resizable()
                            .scaledToFit()
                            .padding(.top,5)

                    }

                    Spacer()
                    Text("版权所有，所有权利保留")
                        .foregroundColor(.gray)
                        .padding()
//                    Button {
//                        dismiss()
//                    } label: {
//                        Text("返回")
//                    }.padding()

                }
//                .frame(width: geometry.size.width * 3 / 4)
//                    .offset(x:geometry.size.width / 8)
            } .navigationBarBackButtonHidden(true) // 隐藏默认返回按钮
                .navigationBarItems(leading: backButton) // 添加自定义返回按钮
                .navigationTitle("关于我们")
        }
        
    }
    var backButton: some View {
        Button(action: {
            dismiss()
        }) {
            HStack {
                Image(systemName: "chevron.backward").foregroundColor(Color(hex: 0x333333))
            }
        }
    }
}

struct AboutUsView_Previews: PreviewProvider {
    static var previews: some View {
        AboutUsView()
    }
}
